package timing.ukulele.web.util;

import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;

public class FileUtil extends timing.ukulele.common.util.FileUtil {

    public static boolean upload(MultipartFile file, String targetFileName) {
        if (file.isEmpty()) {
            return false;
        }
        mkDirs(targetFileName);
        File dest = new File(targetFileName);
        try {
            file.transferTo(dest);
            return true;
        } catch (IOException e) {
            e.printStackTrace();
        }
        return false;
    }
}
